Use the Set Variable
statement to assign a value to a variable. If a variable doesn't exist in the movie or a movie clip, Flash creates the variable when you first assign a value to it.
Set Variable
has the following parameters:
![]() |
The Variable field specifies the name of the variable. It's a good habit to use variable names that indicate what the variable represents. For example, the variable name password indicates that the variable contains a password. |
![]() |
The Value field specifies the value to assign the variable. |
You can use numerical operations and string operators to change the content of a variable. For example, this statement modifies the existing value of the variable totalSum by adding 3 to its current value:
Set Variable: "totalSum" = totalSum + 3
Identifying a variable in a specific movie or movie clip
To identify a variable in a specific movie or movie clip, prefix the variable name with the path to the movie or movie clip.Use a colon to separate the path from the variable name. For example, this phrase specifies the variable Timer in the movie clip Explosion:
/Explosion:Timer